package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppCreditModelTrainingMapper;
import com.ep.modules.app.entity.AppCreditModelTraining;
import com.ep.modules.app.entity.AppCreditModelTrainingExample;
import com.ep.modules.app.service.AppCreditModelTrainingService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppCreditModelTrainingServiceImpl implements AppCreditModelTrainingService {
    @Autowired
    private AppCreditModelTrainingMapper appCreditModelTrainingMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppCreditModelTrainingExample example = new AppCreditModelTrainingExample();
        AppCreditModelTrainingExample.Criteria criteria = example.createCriteria();
        List<AppCreditModelTraining> list = appCreditModelTrainingMapper.selectByExample(example);
        Page<AppCreditModelTraining> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppCreditModelTraining getById(Long id) {
        return appCreditModelTrainingMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppCreditModelTraining entity) {
        appCreditModelTrainingMapper.insert(entity);
    }

    public void update(AppCreditModelTraining entity) {
        appCreditModelTrainingMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appCreditModelTrainingMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}